<template>
  <div class="partners_block">
    <div class="corner top_right"></div>
    <div class="corner top_left"></div>
    <div class="corner bottom_right"></div>
    <div class="corner bottom_left"></div>
    
    <div class="partners_block__ico">
      <img :src="logo" :alt="name">
    </div>
    
    <div class="partners_block__hover">
      <div class="partners_block__hover_in">
        <div class="pb_hover_text">
          {{ description }}
        </div>
        <a v-if="website" class="pb_link" :href="website" target="_blank" rel="noopener noreferrer">
          {{ website }}
        </a>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
defineProps<{
  name: string;
  logo: string;
  description: string;
  website?: string;
}>();
</script>

<style scoped>
/* 使用原网站的样式，改为scoped */
.partners_block {
  width: 33.333%; /* 3列布局 */
  height: 29rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.partners_block:hover .corner {
  opacity: 0;
}

.partners_block:hover .partners_block__hover {
  opacity: 1;
  top: 50%;
}

.partners_block:hover .partners_block__hover:before {
  width: 100%;
}

/* 四个角的装饰边框 */
.corner {
  position: absolute;
  width: 3rem;
  height: 3rem;
  transition: all 0.3s ease-in-out;
}

.corner.top_right {
  top: 0;
  right: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.corner.top_left {
  top: 0;
  left: -1px;
  border-left: 1px solid rgba(255, 255, 255, 0.07);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.corner.bottom_right {
  bottom: -1px;
  right: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.corner.bottom_left {
  left: -1px;
  bottom: -1px;
  border-left: 1px solid rgba(255, 255, 255, 0.07);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

/* Logo显示区 */
.partners_block__ico {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
}

.partners_block__ico img {
  max-width: 15rem;
  max-height: 11.8rem;
  object-fit: contain;
}

/* 悬停层 */
.partners_block__hover {
  position: absolute;
  left: 0;
  top: 100%;
  transform: translateY(-50%);
  width: 100%;
  height: 100%;
  display: table;
  background-color: #232b39;
  box-shadow: 0 4rem 8rem rgba(17, 23, 36, 0.6);
  transition: 0.7s;
  opacity: 0;
  padding: 2rem 3.5rem;
}

.partners_block__hover:before {
  content: '';
  display: block;
  width: 0;
  height: 0.3rem;
  background: #e58707;
  left: 50%;
  top: 0;
  position: absolute;
  transform: translateX(-50%);
  transition: 1.2s;
}

.partners_block__hover_in {
  display: table-cell;
  vertical-align: middle;
}

.partners_block__hover_in > :not(:last-child) {
  margin-bottom: 2rem;
}

.pb_hover_text {
  color: #828c9f;
  font-size: 1.4rem;
  line-height: 2.6rem;
}

.pb_link {
  color: #e58707;
  font-family: ProximaNova;
  font-size: 1.2rem;
  text-decoration: underline;
}

/* 响应式 */
@media screen and (max-width: 1499px) {
  .partners_block {
    height: 22rem;
  }
  
  .partners_block__hover {
    padding: 1rem;
  }
  
  .pb_hover_text {
    line-height: 1.4;
  }
  
  .partners_block__hover_in > :not(:last-child) {
    margin-bottom: 1rem;
  }
}

@media screen and (max-width: 991px) {
  .partners_block {
    width: 50%;
  }
}

@media screen and (max-width: 420px) {
  .partners_block {
    width: 100%;
    height: 20rem;
  }
}
</style>

